home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / demo / wemdemo4.zip / INFO / ELISP.2 < prev    next >
Text File  |  1994-09-21  |  52KB  |  1,258 lines

  1. Info file elisp, produced by Makeinfo, -*- Text -*- from input file
  2. elisp.texi.
  3.  
  4.    This file documents GNU Emacs Lisp.
  5.  
  6.    This is edition 1.03 of the GNU Emacs Lisp Reference Manual,   for
  7. Emacs Version 18.
  8.  
  9.    Published by the Free Software Foundation, 675 Massachusetts
  10. Avenue,  Cambridge, MA 02139 USA
  11.  
  12.    Copyright (C) 1990 Free Software Foundation, Inc.
  13.  
  14.    Permission is granted to make and distribute verbatim copies of
  15. this manual provided the copyright notice and this permission notice
  16. are preserved on all copies.
  17.  
  18.    Permission is granted to copy and distribute modified versions of
  19. this manual under the conditions for verbatim copying, provided that
  20. the entire resulting derived work is distributed under the terms of a
  21. permission notice identical to this one.
  22.  
  23.    Permission is granted to copy and distribute translations of this
  24. manual into another language, under the above conditions for modified
  25. versions, except that this permission notice may be stated in a
  26. translation approved by the Foundation.
  27.  
  28.  
  29. 
  30. File: elisp,  Node: Evaluation Notation,  Next: Printing Notation,  Prev: nil and t,  Up: Conventions
  31.  
  32. Evaluation Notation
  33. -------------------
  34.  
  35.    When you evaluate a piece of Lisp code, it produces a result.  In
  36. the examples in this manual, this is indicated with `=>':
  37.  
  38.      (car '(1 2))
  39.           => 1
  40.  
  41. You can read this as "`(car '(1 2))' evaluates to 1".
  42.  
  43.    When a form is a macro call, it expands into a new form for Lisp
  44. to evaluate.  We show the result of the expansion with `==>'.  We may
  45. or may not show the actual result of the evaluation of the expanded
  46. form.
  47.  
  48.      (third '(a b c))
  49.           ==> (car (cdr (cdr '(a b c))))
  50.           => c
  51.  
  52.    Sometimes to help describe one form we show another form which
  53. produces identical results.  The exact equivalence of two forms is
  54. indicated with `=='.
  55.  
  56.      (make-sparse-keymap) == (list 'keymap)
  57.  
  58.  
  59. 
  60. File: elisp,  Node: Printing Notation,  Next: Error Messages,  Prev: Evaluation Notation,  Up: Conventions
  61.  
  62. Printing Notation
  63. -----------------
  64.  
  65.    Many of the examples in this manual print text when they are
  66. evaluated.  If you execute the code from an example in a Lisp
  67. Interaction buffer (such as the buffer `*scratch*'), the printed text
  68. is inserted into the buffer.  If the example is executed by other
  69. means (such as by evaluating the function `eval-region'), the text
  70. printed is usually displayed in the echo area.  You should be aware
  71. that text displayed in the echo area is truncated to a single line.
  72.  
  73.    In examples that print text, the printed text is indicated with
  74. `-|', irrespective of how the form is executed.  The value returned
  75. by evaluating the form (here `bar') follows on a separate line.
  76.  
  77.      (progn (print 'foo) (print 'bar))
  78.           -| foo
  79.           -| bar
  80.           => bar
  81.  
  82.  
  83. 
  84. File: elisp,  Node: Error Messages,  Next: Buffer Text Notation,  Prev: Printing Notation,  Up: Conventions
  85.  
  86. Error Messages
  87. --------------
  88.  
  89.    Some examples cause errors to be signaled.  In them, the error
  90. message (which always appears in the echo area) is shown on a line
  91. starting with `error-->'.  Note that `error-->' itself does not
  92. appear in the echo area.
  93.  
  94.      (+ 23 'x)
  95.      error--> Wrong type argument: integer-or-marker-p, x
  96.  
  97.  
  98. 
  99. File: elisp,  Node: Buffer Text Notation,  Next: Format of Descriptions,  Prev: Error Messages,  Up: Conventions
  100.  
  101. Buffer Text Notation
  102. --------------------
  103.  
  104.    Some examples show modifications to text in a buffer, with
  105. "before" and "after" versions of the text.  In such cases, the entire
  106. contents of the buffer in question are included between two lines of
  107. dashes containing the buffer name.  In addition, the location of
  108. point is shown as `-!-'.  (The symbol for point, of course, is not
  109. part of the text in the buffer; it indicates the place *between* two
  110. characters where point is located.)
  111.  
  112.      ---------- Buffer: foo ----------
  113.      This is the -!-contents of foo.
  114.      ---------- Buffer: foo ----------
  115.      
  116.      (insert "changed ")
  117.           => nil
  118.      ---------- Buffer: foo ----------
  119.      This is the changed -!-contents of foo.
  120.      ---------- Buffer: foo ----------
  121.  
  122.  
  123. 
  124. File: elisp,  Node: Format of Descriptions,  Prev: Buffer Text Notation,  Up: Conventions
  125.  
  126. Format of Descriptions
  127. ----------------------
  128.  
  129.    Functions, variables, macros, commands, user options, and special
  130. forms are described in this manual in a uniform format.  The first
  131. line of a description contains the name of the item followed by its
  132. arguments, if any.
  133.  
  134.    The category--function, variable, or whatever--appears at the
  135. beginning of the line.
  136.  
  137.    The description follows on succeeding lines, sometimes with
  138. examples.
  139.  
  140. * Menu:
  141.  
  142. * A Sample Function Description::       
  143. * A Sample Variable Description::
  144.  
  145.  
  146. 
  147. File: elisp,  Node: A Sample Function Description,  Next: A Sample Variable Description,  Prev: Format of Descriptions,  Up: Format of Descriptions
  148.  
  149. A Sample Function Description
  150. .............................
  151.  
  152.     In a function description, the name of the function being
  153. described appears first.  It is followed on the same line by a list
  154. of parameters.  The names used for the parameters are also used in
  155. the body of the description.
  156.  
  157.    The appearance of the keyword `&optional' in the parameter list
  158. indicates that the arguments for subsequent parameters may be omitted
  159. (omitted parameters default to `nil').  Do not write `&optional' when
  160. you call the function.
  161.  
  162.    The keyword `&rest' (which will always be followed by a single
  163. parameter) indicates that any number of arguments can follow.  The
  164. value of the single following parameter will be a list of all these
  165. arguments.  Do not write `&rest' when you call the function.
  166.  
  167.    Here is a description of an imaginary function `foo':
  168.  
  169.  * Function: foo INTEGER1 &optional INTEGER2 &rest INTEGERS
  170.      The function `foo' subtracts INTEGER1 from INTEGER2, then adds
  171.      all the rest of the arguments to the result.  If INTEGER2 is not
  172.      supplied, then the number 19 is used by default.
  173.  
  174.           (foo 1 5 3 9)
  175.                => 16
  176.           (foo 5)
  177.                => 14
  178.  
  179.      More generally,
  180.  
  181.           (foo W X Y...)
  182.           ==
  183.           (+ (- X W) Y...)
  184.  
  185.    Any parameter whose name contains the name of a type (e.g.,
  186. INTEGER, INTEGER1 or BUFFER) is expected to be of that type.  A
  187. plural of a type (such as BUFFERS) often means a list of objects of
  188. that type.  Parameters named OBJECT may be of any type.  (*Note Types
  189. of Lisp Object::, for a list of Emacs object types.) Parameters with
  190. other sorts of names (e.g., NEW-FILE) are discussed specifically in
  191. the description of the function.  In some sections, features common
  192. to parameters of several functions are described at the beginning.
  193.  
  194.    *Note Lambda Expressions::, for a more complete description of
  195. optional and rest arguments.
  196.  
  197.    Command, macro, and special form descriptions have the same
  198. format, but the word `Function' is replaced by `Command', `Macro', or
  199. `Special Form', respectively.  Commands are simply functions that may
  200. be called interactively; macros process their arguments differently
  201. from functions (the arguments are not evaluated), but are presented
  202. the same way.
  203.  
  204.    Special form descriptions use a more complex notation to specify
  205. optional and repeated parameters because they can break the argument
  206. list down into separate arguments in more complicated ways. 
  207. ``[OPTIONAL-ARG]'' means that OPTIONAL-ARG is optional and
  208. `REPEATED-ARGS...' stands for zero or more arguments.  Parentheses
  209. are used when several arguments are grouped into additional levels of
  210. list structure.  Here is an example:
  211.  
  212.  * Special Form: count-loop (VAR [FROM TO [INC]]) BODY...
  213.      This imaginary special form implements a loop that executes the
  214.      BODY forms and then increments the variable VAR on each
  215.      iteration.  On the first iteration, the variable has the value
  216.      FROM; on subsequent iterations, it is incremented by 1 (or by
  217.      INC if that is given).  The loop exits before executing BODY if
  218.      VAR equals TO.  Here is an example:
  219.  
  220.           (count-loop (i 0 10)
  221.             (prin1 i) (princ " ")
  222.             (prin1 (aref vector i)) (terpri))
  223.  
  224.      If FROM and TO are omitted, then VAR is bound to `nil' before
  225.      the loop begins, and the loop exits if VAR is non-`nil' at the
  226.      beginning of an iteration.  Here is an example:
  227.  
  228.           (count-loop (done)
  229.             (if (pending)
  230.                 (fixit)
  231.               (setq done t)))
  232.  
  233.      In this special form, the arguments FROM and TO are optional,
  234.      but must both be present or both absent.  If they are present,
  235.      INC may optionally be specified as well.  These arguments are
  236.      grouped with the argument VAR into a list, to distinguish them
  237.      from BODY, which includes all remaining elements of the form.
  238.  
  239.  
  240. 
  241. File: elisp,  Node: A Sample Variable Description,  Prev: A Sample Function Description,  Up: Format of Descriptions
  242.  
  243. A Sample Variable Description
  244. .............................
  245.  
  246.     A "variable" is a name that can hold a value.  Although any
  247. variable can be set by the user, certain variables that exist
  248. specifically so that users can change them are called "user options".
  249. Ordinary variables and user options are described using a format like
  250. that for functions except that there are no arguments.
  251.  
  252.    Here is a description of the imaginary `electric-future-map'
  253. variable.
  254.  
  255.  * Variable: electric-future-map
  256.      The value of this variable is a full keymap used by electric
  257.      command future mode.  The functions in this map will allow you
  258.      to edit commands you have not yet thought about executing.
  259.  
  260.    User option descriptions have the same format, but `Variable' is
  261. replaced by `User Option'.
  262.  
  263.  
  264. 
  265. File: elisp,  Node: Acknowledgements,  Prev: Conventions,  Up: Introduction
  266.  
  267. Acknowledgements
  268. ================
  269.  
  270.    This manual was written by Robert Krawitz, Bil Lewis, Dan
  271. LaLiberte, Richard M. Stallman and Chris Welty, the volunteers of the
  272. GNU manual group, in an effort extending over several years.  Robert
  273. J. Chassell helped to review and edit the manual, with the support of
  274. the Defense Advanced Research Projects Agency, ARPA Order 6082,
  275. arranged by Warren A. Hunt, Jr. of Computational Logic, Inc.
  276.  
  277.    Corrections were supplied by Karl Berry, Bard Bloom, David Boyes,
  278. Alan Carroll, David A. Duff, Beverly Erlebacher, David Eckelkamp,
  279. Eirik Fuller, Eric Hanchrow, George Hartzell, Nathan Hess, Dan
  280. Jacobson, Jak Kirman, Bob Knighten, Frederick M. Korz, Joe Lammens,
  281. K. Richard Magill, Brian Marick, Roland McGrath, Skip Montanaro, John
  282. Gardiner Myers, Arnold D. Robbins, Raul Rockwell, Shinichirou Sugou,
  283. Kimmo Suominen, Edward Tharp, Bill Trost, Jean White, Matthew
  284. Wilding, Carl Witty, Dale Worley, Rusty Wright, and David D. Zuhn.
  285.  
  286.  
  287. 
  288. File: elisp,  Node: Types of Lisp Object,  Next: Numbers,  Prev: Introduction,  Up: Top
  289.  
  290. Lisp Data Types
  291. ***************
  292.  
  293.    A Lisp "object" is a piece of data used and manipulated by Lisp
  294. programs.  For our purposes, a "type" or "data type" is a set of
  295. possible objects.
  296.  
  297.    Every object belongs to at least one type.  Objects of the same
  298. type have similar structures and may usually be used in the same
  299. contexts.  Types can overlap, and objects can belong to two or more
  300. types.  Consequently, we can ask whether an object belongs to a
  301. particular type, but not for "the" type of an object.
  302.  
  303.    A few fundamental object types are built into Emacs.  These, from
  304. which all other types are constructed, are called "primitive types". 
  305. They include "integer", "cons", "symbol", "string", "vector", "subr"
  306. and several special types, such as "buffer", that are related to
  307. editing.  (*Note Editing Types::.)
  308.  
  309.    While an object may be a member of more than one type, every
  310. object is a member of exactly one primitive type.  The primitive type
  311. of an object is stored with the object's data.  A Lisp function is
  312. provided for each primitive type to check whether an object is a
  313. member of that type.
  314.  
  315.    Note that Lisp is unlike many other languages in that Lisp objects
  316. are "self-typing": the primitive type of the object is implicit in
  317. the object itself.  For example, if an object is a vector, it cannot
  318. be treated as a number because Lisp knows it is a vector, not a
  319. number.  In most languages, the programmer must declare the data type
  320. of each variable, and the type is known by the compiler but not
  321. represented in the data.  Such type declarations do not exist in
  322. Emacs Lisp.
  323.  
  324.    This chapter describes the purpose, printed representation, and
  325. read syntax of each of the standard types in GNU Emacs Lisp.  Details
  326. on how to use these types can be found in later chapters.
  327.  
  328. * Menu:
  329.  
  330. * Printed Representation::      How Lisp objects are represented as text.
  331. * Comments::                    Comments and their formatting conventions.
  332. * Programming Types::           Types found in all Lisp systems.
  333. * Editing Types::               Types specific to Emacs.
  334. * Type Predicates::             Tests related to types.
  335. * Equality Predicates::         Tests of equality between any two objects.
  336.  
  337.  
  338. 
  339. File: elisp,  Node: Printed Representation,  Next: Comments,  Prev: Types of Lisp Object,  Up: Types of Lisp Object
  340.  
  341. Printed Representation and Read Syntax
  342. ======================================
  343.  
  344.    The "printed representation" of an object is the format of the
  345. output generated by the Lisp printer (the function `print') for that
  346. object.  The "read syntax" of an object is the format of the input
  347. accepted by the Lisp reader (the function `read') for that object. 
  348. Most objects have more than one possible read syntax.  Some types of
  349. object have no read syntax; except in these cases, the printed
  350. representation of an object is also a read syntax for it.
  351.  
  352.    In other languages, an expression is text; it has no other form. 
  353. In Lisp, an expression is primarily a Lisp object and only
  354. secondarily the text that is the object's read syntax.  Often there
  355. is no need to emphasize this distinction, but you must keep it in the
  356. back of your mind, or you will occasionally be very confused.
  357.  
  358.    Every type has a printed representation.  Some types have no read
  359. syntax, since it may not make sense to enter objects of these types
  360. directly in a Lisp program.  For example, the buffer type does not
  361. have a read syntax.  Objects of these types are printed in "hash
  362. notation": the characters `#<' followed by a descriptive string
  363. (typically the type name followed by the name of the object), and
  364. closed with a matching `>'.  Hash notation cannot be read at all, so
  365. the Lisp reader signals the error `invalid-read-syntax' whenever a
  366. `#' is encountered.
  367.  
  368.      (current-buffer)
  369.           => #<buffer objects.texi>
  370.  
  371.    When you evaluate an expression interactively, the Lisp
  372. interpreter first reads the textual representation of it, producing a
  373. Lisp object, and then evaluates that object (*note Evaluation::.). 
  374. However, evaluation and reading are separate activities.  Reading
  375. returns the Lisp object represented by the text that is read; the
  376. object may or may not be evaluated later.  *Note Input Functions::,
  377. for a description of `read', the basic function for reading objects.
  378.  
  379.  
  380. 
  381. File: elisp,  Node: Comments,  Next: Programming Types,  Prev: Printed Representation,  Up: Types of Lisp Object
  382.  
  383. Comments
  384. ========
  385.  
  386.    A "comment" is text that is written in a program only for the sake
  387. of humans that read the program, and that has no effect on the
  388. meaning of the program.  In Lisp, a comment starts with a semicolon
  389. (`;') and continues to the end of line.  Comments are discarded by
  390. the Lisp reader, and do not become part of the Lisp objects which
  391. represent the program within the Lisp system.
  392.  
  393.    We recommend these conventions for where to put comments and how
  394. to indent them:
  395.  
  396. `;'
  397.      Comments that start with a single semicolon, `;', should all be
  398.      aligned to the same column on the right of the source code. 
  399.      Such comments usually explain how the code on the same line does
  400.      its job.  In Lisp mode and related modes, the `M-;'
  401.      (`indent-for-comment') command automatically inserts such a `;'
  402.      in the right place, or aligns such a comment if it is already
  403.      inserted.
  404.  
  405.      (The following examples are taken from the Emacs sources.)
  406.  
  407.           (setq base-version-list                 ; there was a base
  408.                 (assoc (substring fn 0 start-vn)  ; version to which
  409.                        file-version-assoc-list))  ; this looks like
  410.                                                   ; a subversion
  411.  
  412. `;;'
  413.      Comments that start with two semicolons, `;;', should be aligned
  414.      to the same level of indentation as the code.  Such comments are
  415.      used to describe the purpose of the following lines or the state
  416.      of the program at that point.  For example:
  417.  
  418.             (prog1 (setq auto-fill-hook
  419.                          ...
  420.                          ...
  421.               ;; update mode-line
  422.               (set-buffer-modified-p (buffer-modified-p))))
  423.  
  424.      These comments are also written before a function definition to
  425.      explain what the function does and how to call it properly.
  426.  
  427. `;;;'
  428.      Comments that start with three semicolons, `;;;', should start
  429.      at the left margin.  Such comments are not used within function
  430.      definitions, but are used to make more general comments.  For
  431.      example:
  432.  
  433.           ;;; This Lisp code is run in Emacs when it is to operate as
  434.           ;;; a server for other processes.
  435.  
  436. `;;;;'
  437.      Comments that start with four semicolons, `;;;;', should be
  438.      aligned to the left margin and are used for headings of major
  439.      sections of a program.  For example:
  440.  
  441.           ;;;; The kill ring
  442.  
  443. The indentation commands of the Lisp modes in Emacs, such as `M-;'
  444. (`indent-for-comment') and TAB (`lisp-indent-line') automatically
  445. indent comments according to these conventions, depending on the the
  446. number of semicolons.  *Note : (emacs)Comments.
  447.  
  448.    Any character may be included in a comment, but it is advisable to
  449. precede a character with syntactic significance in Lisp (such as `\'
  450. or unpaired `(' or `)') with a `\', to prevent it from confusing the
  451. Emacs commands for editing Lisp.
  452.  
  453.  
  454. 
  455. File: elisp,  Node: Programming Types,  Next: Editing Types,  Prev: Comments,  Up: Types of Lisp Object
  456.  
  457. Programming Types
  458. =================
  459.  
  460.    There are two general categories of types in Emacs Lisp: those
  461. having to do with Lisp programming, and those having to do with
  462. editing.  The former are provided in many Lisp implementations, in
  463. one form or another.  The latter are unique to Emacs Lisp.
  464.  
  465. * Menu:
  466.  
  467. * Number Type::         Primarily integers.
  468. * Character Type::      The representation of letters, numbers and
  469.                         control characters.
  470. * Sequence Type::       Both lists and arrays are classified as sequences.
  471. * List Type::           Lists gave Lisp its name (not to mention reputation).
  472. * Array Type::          Arrays include strings and vectors.
  473. * String Type::         An (efficient) array of characters.
  474. * Vector Type::         One-dimensional arrays.
  475. * Symbol Type::         A multi-use object that refers to a function,
  476.                         variable, property list, or itself.
  477. * Lisp Function Type::  A piece of executable code you can call from elsewhere.
  478. * Lisp Macro Type::     A method of expanding an expression into another
  479.                           expression, more fundamental but less pretty.
  480. * Primitive Function Type::     A function written in C, callable from Lisp.
  481. * Autoload Type::       A type used for automatically loading seldom-used
  482.                         functions.
  483.  
  484.  
  485. 
  486. File: elisp,  Node: Number Type,  Next: Character Type,  Prev: Programming Types,  Up: Programming Types
  487.  
  488. Number Type
  489. -----------
  490.  
  491.    Integers are the only kind of number in GNU Emacs Lisp, version 18.
  492. The range of values for integers is -8388608 to 8388607 (24 bits; i.e.,
  493.  
  494.    -2**23
  495.  
  496.    to
  497.  
  498.    2**23 - 1)
  499.  
  500.    on most machines, but is 25 or 26 bits on some systems.  It is
  501. important to note that the Emacs Lisp arithmetic functions do not
  502. check for overflow.  Thus `(1+ 8388607)' is -8388608 on 24-bit
  503. implementations.
  504.  
  505.    Version 19 supports floating point numbers.
  506.  
  507.    The read syntax for numbers is a sequence of (base ten) digits
  508. with an optional sign.  The printed representation produced by the
  509. Lisp interpreter never has a leading `+'.
  510.  
  511.      -1               ; The integer -1.
  512.      1                ; The integer 1.
  513.      +1               ; Also the integer 1.
  514.      16777217         ; Also the integer 1! (on a 24-bit or 25-bit implementation)
  515.  
  516.    *Note Numbers::, for more information.
  517.  
  518.  
  519. 
  520. File: elisp,  Node: Character Type,  Next: Sequence Type,  Prev: Number Type,  Up: Programming Types
  521.  
  522. Character Type
  523. --------------
  524.  
  525.    A "character" in Emacs Lisp is nothing more than an integer.  In
  526. other words, characters are represented by their eight-bit ASCII
  527. values.  For example, the character `A' is represented as the
  528. integer 65.  If an arbitrary integer is used as a character, only
  529. the lower eight bits are significant.
  530.  
  531.    Individual characters are not often used in programs.  It is far
  532. more common to work with *strings*, which are sequences composed of
  533. characters.  *Note String Type::.
  534.  
  535.    Since characters are really integers, the printed representation
  536. of a character is a decimal number.  This is also a possible read
  537. syntax for a character, but it is not convenient for that purpose. 
  538. Therefore, Emacs Lisp provides a variety of read syntax formats, such
  539. as `?A' and `?\101', for entering characters.  They all start with a
  540. question mark.
  541.  
  542.    The usual read syntax for alphanumeric characters is a question
  543. mark followed by the character; thus, `?A' for the character `A',
  544. `?B' for the character `B', and `?a' for the character `a'.  For
  545. example:
  546.  
  547.      ?Q => 81
  548.      
  549.      ?q => 113
  550.  
  551.    The characters backspace, tab, newline, vertical tab, formfeed,
  552. return, and escape may be represented as `?\b', `?\t', `?\n', `?\v',
  553. `?\f', `?\r', `?\e', respectively.  Those values are 8, 9, 10, 11,
  554. 12, 13, and 27 in decimal.  Thus,
  555.  
  556.      ?\b => 8                 ; backspace, BS, `C-h'
  557.      ?\t => 9                 ; tab, TAB, `C-i'
  558.      ?\n => 10                ; newline, LFD, `C-j'
  559.      ?\v => 11                ; vertical tab, `C-k'
  560.      ?\f => 12                ; formfeed character, `C-l'
  561.      ?\r => 13                ; carriage return, RET, `C-m'
  562.      ?\e => 27                ; escape character, ESC, `C-['
  563.      ?\\ => 92                ; backslash character, `\'
  564.  
  565.    Control characters may be represented using yet another read syntax.
  566. This consists of a question mark followed by a backslash, caret, and
  567. the corresponding non-control character, in either upper or lower
  568. case.  For example, either `?\^I' or `?\^i' may be used as the read
  569. syntax for the character `C-i', the character whose value is 9.
  570.  
  571.    Instead of the `^', you can use `C-'; thus, `?\C-i' is equivalent
  572. to `?\^I', and `?\C-i' is equivalent to `?\^i'.  For example:
  573.  
  574.      ?\^I => 9
  575.      
  576.      ?\C-I => 9
  577.  
  578.    The DEL key can be considered and written as `Control-?':
  579.  
  580.      ?\^? => 127
  581.      
  582.      ?\C-? => 127
  583.  
  584.    When you represent control characters to be found in files or
  585. strings, we recommend the `^' syntax; but when you refer to keyboard
  586. input, we prefer the `C-' syntax.  This does not affect the meaning
  587. of the program, but may guide the understanding of people who read it.
  588.  
  589.    A "meta character" is a character that has its eighth bit set. 
  590. The read syntax for these characters is question mark, backslash,
  591. `M-', and the corresponding seven-bit character.  For example,
  592. `?\M-A' stands for `M-A', the character with code 193 (301 octal). 
  593. The seven-bit character can be written directly or specified by any
  594. of the `\' escapes described above or below.  Thus, `M-A' can be
  595. written as `?\M-A', or as `?\M-\101', or as `?\301'.  Likewise, the
  596. character whose decimal printed representation is 130 (202 octal) can
  597. use any one of the following for its read syntax: `?\202',
  598. `?\M-\C-b', `?\C-\M-b', or `?\M-\002'.  For example:
  599.  
  600.      ?\C-\M-b => 130          ?\M-\C-b => 130
  601.      
  602.      ?\^\M-b => 130           ?\M-\002 => 130
  603.  
  604.    Finally, the most general read syntax consists of a question mark
  605. followed by a backslash and the ASCII code for the character in octal
  606. (up to three octal digits); thus, `?\101' for the character `A',
  607. `?\001' for the character `C-a', and `?\002' for the character `C-b'.
  608. Although this syntax can represent any character, it is preferred
  609. only when the precise octal value is more important than the ASCII
  610. representation.  (These sequences which start with backslash are also
  611. known as "escape sequences", because backslash plays the role of an
  612. escape character, but they have nothing to do with the character ESC.)
  613.  
  614.      ?\012 => 10        ?\n => 10         ?\C-j => 10
  615.      
  616.      ?\101 => 65        ?A => 65           
  617.      
  618.      ?\301 => 193       ?\M-A => 193      ?\M-\101 => 193
  619.  
  620.    A backslash is allowed, and harmless, preceding any character
  621. without a special escape meaning; thus, `?\A' is equivalent to `?A'. 
  622. There is no reason to use a backslash before most such characters. 
  623. However, any of the characters `()\|;'`"#.,' should be preceded by a
  624. backslash to avoid confusing the Emacs commands for editing Lisp code.
  625. Whitespace characters such as space, tab, newline and formfeed should
  626. also be preceded by a backslash.  However, it is cleaner to use one
  627. of the easily readable escape sequences, such as `\t', instead of an
  628. actual control character such as a tab.
  629.  
  630.  
  631. 
  632. File: elisp,  Node: Sequence Type,  Next: List Type,  Prev: Character Type,  Up: Programming Types
  633.  
  634. Sequence Types
  635. --------------
  636.  
  637.    A "sequence" is a Lisp object that represents an ordered set of
  638. elements.  There are two kinds of sequence in Emacs Lisp, lists and
  639. arrays.  Thus, an object of type list or of type array is also
  640. considered a sequence.
  641.  
  642.    Arrays are further subdivided into strings and vectors.  Vectors
  643. can hold elements of any type, but string elements must be
  644. characters--integers from 0 to 255.
  645.  
  646.    Lists, strings and vectors are different, but they have important
  647. similarities.  For example, all have a length L, and all have
  648. elements which can be indexed from zero to L minus one.  Also,
  649. several functions, called sequence functions, accept any kind of
  650. sequence.  For example, the function `elt' can be used to extract an
  651. element of a sequence, given its index.  *Note Sequences Arrays
  652. Vectors::.
  653.  
  654.    It is impossible to read the same sequence twice, in the sense of
  655. `eq' (*note Equality Predicates::.), since sequences are always
  656. created anew upon reading.  There is one exception: the empty list
  657. `()' is always read as the same object, `nil'.
  658.  
  659.  
  660. 
  661. File: elisp,  Node: List Type,  Next: Array Type,  Prev: Sequence Type,  Up: Programming Types
  662.  
  663. List Type
  664. ---------
  665.  
  666.    A "list" is a series of cons cells, linked together.  A "cons
  667. cell" is an object comprising two pointers named the CAR and the CDR.
  668. Each of them can point to any Lisp object, but when the cons cell is
  669. part of a list, the CDR points either to another cons cell or to the
  670. empty list.  *Note Lists::, for functions that work on lists.
  671.  
  672.    The names CAR and CDR have only historical meaning now.  The
  673. original Lisp implementation ran on an IBM 704 computer which divided
  674. words into two parts, called the "address" part and the "decrement";
  675. CAR was an instruction to extract the contents of the address part of
  676. a register, and CDR an instruction to extract the contents of the
  677. decrement.  By contrast, "cons cells" are named for the function
  678. `cons' that creates them, which in turn is named for its purpose, the
  679. construction of cells.
  680.  
  681.    Because cons cells are so central to Lisp, we also have a word for
  682. "an object which is not a cons cell".  These objects are called
  683. "atoms".
  684.  
  685.    The read syntax and printed representation for lists are
  686. identical, and consist of a left parenthesis, an arbitrary number of
  687. elements, and a right parenthesis.
  688.  
  689.    Upon reading, any object inside the parentheses is made into an
  690. element of the list.  That is, a cons cell is made for each element. 
  691. The CAR of the cons cell points to the element, and its CDR points to
  692. the next cons cell which holds the next element in the list.  The CDR
  693. of the last cons cell is set to point to `nil'.
  694.  
  695.    A list can be illustrated by a diagram in which the cons cells are
  696. shown as pairs of boxes.  (The Lisp reader cannot read such an
  697. illustration; unlike the textual notation, which can be understood
  698. both humans and computers, the box illustrations can only be
  699. understood by humans.)  The following represents the three-element
  700. list `(rose violet buttercup)':
  701.  
  702.          ___ ___      ___ ___      ___ ___
  703.         |___|___|--> |___|___|--> |___|___|--> nil
  704.           |            |            |
  705.           |            |            |
  706.            --> rose     --> violet   --> buttercup
  707.  
  708.    In the diagram, each box represents a slot that can refer to any
  709. Lisp object.  Each pair of boxes represents a cons cell.  Each arrow
  710. is a reference to a Lisp object, either an atom or another cons cell.
  711.  
  712.    In this example, the first box, the CAR of the first cons cell,
  713. refers to or "contains" `rose' (a symbol).  The second box, the CDR
  714. of the first cons cell, refers to the next pair of boxes, the second
  715. cons cell.  The CAR of the second cons cell refers to `violet' and
  716. the CDR refers to the third cons cell.  The CDR of the third (and
  717. last) cons cell refers to `nil'.
  718.  
  719.    Here is another diagram of the same list, `(rose violet
  720. buttercup)', sketched in a different manner:
  721.  
  722.       ---------------         ----------------         -------------------
  723.      |car    |cdr    |       |car     |cdr    |       |car        |cdr    |
  724.      | rose  |   o---------->| violet |   o---------->| buttercup |  nil  |
  725.      |       |       |       |        |       |       |           |       |
  726.       ---------------         ----------------         -------------------
  727.  
  728.    A list with no elements in it is the "empty list"; it is identical
  729. to the symbol `nil'.  In other words, `nil' is both a symbol and a
  730. list.
  731.  
  732.    Here are examples of lists written in Lisp syntax:
  733.  
  734.      (A 2 "A")            ; A list of three elements.
  735.      ()                   ; A list of no elements (the empty list).
  736.      nil                  ; A list of no elements (the empty list).
  737.      ("A ()")             ; A list of one element: the string `"A ()"'.
  738.      (A ())               ; A list of two elements: `A' and the empty list.
  739.      (A nil)              ; Equivalent to the previous.
  740.      ((A B C))            ; A list of one element
  741.                           ; (which is a list of three elements).
  742.  
  743.     Here is the list `(A ())', or equivalently `(A nil)', depicted
  744. with boxes and arrows:
  745.  
  746.          ___ ___      ___ ___
  747.         |___|___|--> |___|___|--> nil
  748.           |            |
  749.           |            |
  750.            --> A        --> nil
  751.  
  752. * Menu:
  753.  
  754. * Dotted Pair Notation::        An alternative syntax for lists.
  755. * Association List Type::       A specially constructed list.
  756.  
  757.  
  758. 
  759. File: elisp,  Node: Dotted Pair Notation,  Next: Association List Type,  Prev: List Type,  Up: List Type
  760.  
  761. Dotted Pair Notation
  762. ....................
  763.  
  764.     "Dotted pair notation" is an alternative syntax for cons cells
  765. that represents the CAR and CDR explicitly.  In this syntax, `(A .
  766. B)' stands for a cons cell whose CAR is the object A, and whose CDR
  767. is the object B.  Dotted pair notation is therefore more general than
  768. list syntax.  In the dotted pair notation, the list `(1 2 3)' is
  769. written as `(1 .  (2 . (3 . nil)))'.  For `nil'-terminated lists, the
  770. two notations produce the same result, but list notation is usually
  771. clearer and more convenient when it is applicable.  When printing a
  772. list, the dotted pair notation is only used if the CDR of a cell is
  773. not a list.
  774.  
  775.    Box notation can also be used to illustrate what dotted pairs look
  776. like.  For example, `(rose . violet)' is diagrammed as follows:
  777.  
  778.          ___ ___
  779.         |___|___|--> violet
  780.           |
  781.           |
  782.            --> rose
  783.  
  784.    Dotted pair notation can be combined with list notation to
  785. represent a chain of cons cells with a non-`nil' final CDR.  For
  786. example, `(rose violet . buttercup)' is equivalent to `(rose .
  787. (violet . buttercup))'.  The object looks like this:
  788.  
  789.          ___ ___      ___ ___
  790.         |___|___|--> |___|___|--> buttercup
  791.           |            |
  792.           |            |
  793.            --> rose     --> violet
  794.  
  795.    These diagrams make it evident that `(rose . violet . buttercup)'
  796. must have an invalid syntax since it would require that a cons cell
  797. have three parts rather than two.
  798.  
  799.    The list `(rose violet)' is equivalent to `(rose . (violet))' and
  800. looks like this:
  801.  
  802.          ___ ___      ___ ___
  803.         |___|___|--> |___|___|--> nil
  804.           |            |
  805.           |            |
  806.            --> rose     --> violet
  807.  
  808.    Similarly, the three-element list `(rose violet buttercup)' is
  809. equivalent to `(rose . (violet . (buttercup)))'.
  810.  
  811.    It looks like this:
  812.  
  813.          ___ ___      ___ ___      ___ ___
  814.         |___|___|--> |___|___|--> |___|___|--> nil
  815.           |            |            |
  816.           |            |            |
  817.            --> rose     --> violet   --> buttercup
  818.  
  819.  
  820. 
  821. File: elisp,  Node: Association List Type,  Prev: Dotted Pair Notation,  Up: List Type
  822.  
  823. Association List Type
  824. .....................
  825.  
  826.     An "association list" or "alist" is a specially-constructed list
  827. whose elements are cons cells.  In each element, the CAR is
  828. considered a "key", and the CDR is considered an "associated value". 
  829. (In some cases, the associated value is stored in the CAR of the
  830. CDR.)  Association lists are often used to implement stacks, since
  831. new associations may easily be added to or removed from the front of
  832. the list.
  833.  
  834.    For example,
  835.  
  836.      (setq alist-of-colors '((rose . red) (lily . white)  (buttercup . yellow)))
  837.  
  838. sets the variable `alist-of-colors' to an alist of three elements. 
  839. In the first element, `rose' is the key and `red' is the value.
  840.  
  841.    *Note Association Lists::, for a further explanation of alists and
  842. for functions that work on alists.
  843.  
  844.  
  845. 
  846. File: elisp,  Node: Array Type,  Next: String Type,  Prev: List Type,  Up: Programming Types
  847.  
  848. Array Type
  849. ----------
  850.  
  851.    An "array" is composed of an arbitrary number of other Lisp
  852. objects, arranged in a contiguous block of memory.  Any element of an
  853. array may be accessed in constant time.  In contrast, accessing an
  854. element of a list requires time proportional to the position of the
  855. element in the list.  (Elements at the end of a list take longer to
  856. access than elements at the beginning of a list.)
  857.  
  858.    Emacs defines two types of array, strings and vectors.  A string
  859. is an array of characters and a vector is an array of arbitrary
  860. objects.  Both are one-dimensional.  (Most other programming
  861. languages support multidimensional arrays, but we don't think they
  862. are essential in Emacs Lisp.)  Each type of array has its own read
  863. syntax; see *Note String Type::, and *Note Vector Type::.
  864.  
  865.    An array may have any length up to the largest integer; but once
  866. created, it has a fixed size.  The first element of an array has
  867. index zero, the second element has index 1, and so on.  This is
  868. called "zero-origin" indexing.  For example, an array of four
  869. elements has indices 0, 1, 2, and 3.
  870.  
  871.    The array type is contained in the sequence type and contains both
  872. strings and vectors.
  873.  
  874.  
  875. 
  876. File: elisp,  Node: String Type,  Next: Vector Type,  Prev: Array Type,  Up: Programming Types
  877.  
  878. String Type
  879. -----------
  880.  
  881.    A "string" is an array of characters.  Strings are used for many
  882. purposes in Emacs, as can be expected in a text editor; for example,
  883. as the names of Lisp symbols, as messages for the user, and to
  884. represent text extracted from buffers.  Strings in Lisp are
  885. constants; evaluation of a string returns the same string.
  886.  
  887.    The read syntax for strings is a double-quote, an arbitrary number
  888. of characters, and another double-quote, `"like this"'.  The Lisp
  889. reader accepts the same formats for reading the characters of a
  890. string as it does for reading single characters (without the question
  891. mark that begins a character literal).  You can enter a nonprinting
  892. character such as tab, `C-a' or `M-C-A' using the convenient escape
  893. sequences, like this: `"\t, \C-a, \M-\C-a"'.  You can include a
  894. double-quote in a string by preceding it with a backslash; thus,
  895. `"\""' is a string containing just a single double-quote character. 
  896. (*Note Character Type::, for a description of the read syntax for
  897. characters.)
  898.  
  899.    In contrast with the C programming language, newlines are allowed
  900. in Emacs Lisp string literals.  But an escaped newline--one that is
  901. preceded by `\'--does not become part of the string; i.e., the Lisp
  902. reader ignores an escaped newline in a string literal.
  903.  
  904.      "It is useful to include newlines in
  905.      documentation strings, but the newline is \
  906.      ignored if escaped."
  907.           => "It is useful to include newlines in
  908.      documentation strings, but the newline is ignored if escaped."
  909.  
  910.    The printed representation of a string consists of a double-quote,
  911. the characters it contains, and another double-quote.  However, any
  912. backslash or double-quote characters in the string are preceded with
  913. a backslash like this: `"this \" is an embedded quote"'.
  914.  
  915.    *Note Strings and Characters::, for functions that work on strings.
  916.  
  917.  
  918. 
  919. File: elisp,  Node: Vector Type,  Next: Symbol Type,  Prev: String Type,  Up: Programming Types
  920.  
  921. Vector Type
  922. -----------
  923.  
  924.    A "vector" is a one-dimensional array of elements of any type.  It
  925. takes a constant amount of time to access any element of a vector. 
  926. (In a list, the access time of an element is proportional to the
  927. distance of the element from the beginning of the list.)
  928.  
  929.    The printed representation of a vector consists of a left square
  930. bracket, the elements, and a right square bracket.  This is also the
  931. read syntax.  Like numbers and strings, vectors are considered
  932. constants for evaluation.
  933.  
  934.      [1 "two" (three)]      ; A vector of three elements.
  935.           => [1 "two" (three)]
  936.  
  937.    *Note Vectors::, for functions that work with vectors.
  938.  
  939.  
  940. 
  941. File: elisp,  Node: Symbol Type,  Next: Lisp Function Type,  Prev: Vector Type,  Up: Programming Types
  942.  
  943. Symbol Type
  944. -----------
  945.  
  946.    A "symbol" in GNU Emacs Lisp is an object with a name.  The symbol
  947. name is the printed representation of the symbol.  In ordinary use,
  948. the name is unique--no two symbols have the same name.
  949.  
  950.    A symbol may be used in programs as a variable, as a function
  951. name, or to hold a list of properties.  Or it may serve only to be
  952. distinct from all other Lisp objects, so that its presence in a data
  953. structure may be recognized reliably.  In a given context, usually
  954. only one of these uses is intended.
  955.  
  956.    A symbol name can contain any characters whatever.  Most symbol
  957. names are written with letters, digits, and the punctuation
  958. characters `-+=*/'.  Such names require no special punctuation; the
  959. characters of the name suffice as long as the name does not look like
  960. a number.  (If it does, write a `\' at the beginning of the name to
  961. force interpretation as a symbol.)  The characters `_~!@$%^&:<>{}'
  962. are less often used but also require no special punctuation.  Any
  963. other characters may be included in a symbol's name by escaping them
  964. with a backslash.  In contrast to its use in strings, however, a
  965. backslash in the name of a symbol quotes the single character that
  966. follows the backslash, without conversion.  For example, in a string,
  967. `\t' represents a tab character; in the name of a symbol, however,
  968. `\t' merely quotes the letter `t'.  To have a symbol with a tab
  969. character in its name, you must actually type an tab (preceded with a
  970. backslash).  But you would hardly ever do such a thing.
  971.  
  972.      Common Lisp note: in Common Lisp, lower case letters are always
  973.      "folded" to upper case, unless they are explicitly escaped. 
  974.      This is in contrast to Emacs Lisp, in which upper case and lower
  975.      case letters are distinct.
  976.  
  977.    Here are several examples of symbol names.  Note that the `+' in
  978. the fifth example is escaped to prevent it from being read as a number.
  979. This is not necessary in the last example because the rest of the
  980. name makes it invalid as a number.
  981.  
  982.      foo                 ; A symbol named `foo'.
  983.      FOO                 ; A symbol named `FOO', different from `foo'.
  984.      char-to-string      ; A symbol named `char-to-string'.
  985.      1+                  ; A symbol named `1+'
  986.                          ;     (not `+1', which is an integer).
  987.      \+1                 ; A symbol named `+1' (not a very readable name).
  988.      \(*\ 1\ 2\)         ; A symbol named `(* 1 2)' (a worse name).
  989.      +-*/_~!@$%^&=:<>{}  ; A symbol named `+-*/_~!@$%^&=:<>{}'.
  990.                          ;     These characters need not be escaped.
  991.  
  992.  
  993. 
  994. File: elisp,  Node: Lisp Function Type,  Next: Lisp Macro Type,  Prev: Symbol Type,  Up: Programming Types
  995.  
  996. Lisp Function Type
  997. ------------------
  998.  
  999.    Just as functions in other programming languages are executable, a
  1000. "Lisp function" object is a piece of executable code.  However, Lisp
  1001. functions are primarily Lisp objects, and only secondarily the text
  1002. which represents them.  These Lisp objects are lambda expressions:
  1003. lists whose first element is the symbol `lambda' (*note Lambda
  1004. Expressions::.).
  1005.  
  1006.    In most programming languages, it is impossible to have a function
  1007. without a name.  In Lisp, a function has no intrinsic name.  A lambda
  1008. expression is also called an "anonymous function" (*note Anonymous
  1009. Functions::.).  A named function in Lisp is actually a symbol with a
  1010. valid function in its function cell (*note Defining Functions::.).
  1011.  
  1012.    Most of the time, functions are called when their names are
  1013. written in Lisp expressions in Lisp programs.  However, a function
  1014. object found or constructed at run time can be called and passed
  1015. arguments with the primitive functions `funcall' and `apply'.  *Note
  1016. Calling Functions::.
  1017.  
  1018.  
  1019. 
  1020. File: elisp,  Node: Lisp Macro Type,  Next: Primitive Function Type,  Prev: Lisp Function Type,  Up: Programming Types
  1021.  
  1022. Lisp Macro Type
  1023. ---------------
  1024.  
  1025.    A "Lisp macro" is a user-defined construct that extends the Lisp
  1026. language.  It is represented as an object much like a function, but
  1027. with different parameter-passing semantics.  A Lisp macro has the
  1028. form of a list whose first element is the symbol `macro' and whose
  1029. CDR is a Lisp function object, including the `lambda' symbol.
  1030.  
  1031.    Lisp macro objects are usually defined with the built-in function
  1032. `defmacro', but any list that begins with `macro' is a macro as far
  1033. as Emacs is concerned.  *Note Macros::, for an explanation of how to
  1034. write a macro.
  1035.  
  1036.  
  1037. 
  1038. File: elisp,  Node: Primitive Function Type,  Next: Autoload Type,  Prev: Lisp Macro Type,  Up: Programming Types
  1039.  
  1040. Primitive Function Type
  1041. -----------------------
  1042.  
  1043.    A "primitive function" is a function callable from Lisp but
  1044. written in the C programming language.  Primitive functions are also
  1045. called "subrs" or "built-in functions".  (The word "subr" is derived
  1046. from "subroutine".)  Most primitive functions evaluate all their
  1047. arguments when they are called.  A primitive function that does not
  1048. evaluate all its arguments is called a "special form" (*note Special
  1049. Forms::.).
  1050.  
  1051.    It does not matter to the caller of a function whether the
  1052. function is primitive.  However, this does matter if you are trying
  1053. to substitute a function written in Lisp for a primitive of the same
  1054. name.  The reason is that the primitive function may be called
  1055. directly from C code.  When the redefined function is called from
  1056. Lisp, the new definition will be used; but calls from C code may
  1057. still use the old definition.
  1058.  
  1059.    The term "function" is used to refer to all Emacs functions,
  1060. whether written in Lisp or C.  *Note Lisp Function Type::, for
  1061. information about the functions written in Lisp.
  1062.  
  1063.    Primitive functions have no read syntax and print in hash notation
  1064. with the name of the subroutine.
  1065.  
  1066.      (symbol-function 'car)          ; Access the function cell of the symbol.
  1067.           => #<subr car>
  1068.      (subrp (symbol-function 'car))  ; Is this a primitive function?
  1069.           => t                       ; Yes.
  1070.  
  1071.  
  1072. 
  1073. File: elisp,  Node: Autoload Type,  Prev: Primitive Function Type,  Up: Programming Types
  1074.  
  1075. Autoload Type
  1076. -------------
  1077.  
  1078.    An "autoload object" is a list whose first element is the symbol
  1079. `autoload'.  It is stored as the function definition of a symbol to
  1080. say that a file of Lisp code should be loaded when necessary to find
  1081. the true definition of that symbol.  The autoload object contains the
  1082. name of the file, plus some other information about the real
  1083. definition.
  1084.  
  1085.    After the file has been loaded, the symbol should have a new
  1086. function definition that is not an autoload object.  The new
  1087. definition is then called as if it had been there to begin with. 
  1088. From the user's point of view, the function call works as expected,
  1089. using the function definition in the loaded file.
  1090.  
  1091.    An autoload object is usually created with the function
  1092. `autoload', which stores the object in the function cell of a symbol.
  1093. *Note Autoload::, for more details.
  1094.  
  1095.  
  1096. 
  1097. File: elisp,  Node: Editing Types,  Next: Type Predicates,  Prev: Programming Types,  Up: Types of Lisp Object
  1098.  
  1099. Editing Types
  1100. =============
  1101.  
  1102.    The types in the previous section are common to many Lisp-like
  1103. languages.  But Emacs Lisp provides several additional data types for
  1104. purposes connected with editing.
  1105.  
  1106. * Menu:
  1107.  
  1108. * Buffer Type::         The basic object of editing.
  1109. * Window Type::         What makes buffers visible.
  1110. * Window Configuration Type::   Save what the screen looks like.
  1111. * Marker Type::         A position in a buffer.
  1112. * Process Type::        A process running on the underlying OS.
  1113. * Stream Type::         Receive or send characters.
  1114. * Keymap Type::         What function a keystroke invokes.
  1115. * Syntax Table Type::   What a character means.
  1116.  
  1117.  
  1118. 
  1119. File: elisp,  Node: Buffer Type,  Next: Window Type,  Prev: Editing Types,  Up: Editing Types
  1120.  
  1121. Buffer Type
  1122. -----------
  1123.  
  1124.    A "buffer" is an object that holds text that can be edited (*note
  1125. Buffers::.).  Most buffers hold the contents of a disk file (*note
  1126. Files::.) so they can be edited, but some are used for other
  1127. purposes.  Most buffers are also meant to be seen by the user, and
  1128. therefore displayed, at some time, in a window (*note Windows::.). 
  1129. But a buffer need not be displayed in a window.
  1130.  
  1131.    The contents of a buffer are much like a string, but buffers are
  1132. not used like strings in Emacs Lisp, and the available operations are
  1133. different.  For example, text can be inserted into a buffer very
  1134. quickly, while "inserting" text into a string is accomplished by
  1135. concatenation and the result is an entirely new string object.
  1136.  
  1137.    Each buffer has a designated position called "point" (*note
  1138. Positions::.).  And one buffer is the "current buffer".  Most editing
  1139. commands act on the contents of the current buffer in the
  1140. neighborhood of point.  Many other functions manipulate or test the
  1141. characters in the current buffer and much of this manual is devoted
  1142. to describing these functions (*note Text::.).
  1143.  
  1144.    Several other data structures are associated with each buffer:
  1145.  
  1146.    * a local syntax table (*note Syntax Tables::.);
  1147.  
  1148.    * a local keymap (*note Keymaps::.); and,
  1149.  
  1150.    * a local variable binding list (*note Variables::.).
  1151.  
  1152. The local keymap and variable list contain entries which individually
  1153. override global bindings or values.  These are used to customize the
  1154. behavior of programs in different buffers, without actually changing
  1155. the programs.
  1156.  
  1157.    Buffers have no read syntax.  They print in hash notation with the
  1158. buffer name.
  1159.  
  1160.      (current-buffer)
  1161.           => #<buffer objects.texi>
  1162.  
  1163.  
  1164. 
  1165. File: elisp,  Node: Window Type,  Next: Window Configuration Type,  Prev: Buffer Type,  Up: Editing Types
  1166.  
  1167. Window Type
  1168. -----------
  1169.  
  1170.    A "window" describes the portion of the terminal screen that Emacs
  1171. uses to display a buffer.  Every window has one associated buffer,
  1172. whose contents appear in the window.  By contrast, a given buffer may
  1173. appear in one window, no window, or several windows.
  1174.  
  1175.    Though many windows may exist simultaneously, one window is
  1176. designated the "selected window".  This is the window where the
  1177. cursor is (usually) displayed when Emacs is ready for a command.  The
  1178. selected window usually displays the current buffer, but this is not
  1179. necessarily the case.
  1180.  
  1181.    Windows have no read syntax.  They print in hash notation, giving
  1182. the window number and the name of the buffer being displayed.  The
  1183. window numbers exist to identify windows uniquely, since the buffer
  1184. displayed in any given window can change frequently.
  1185.  
  1186.      (selected-window)
  1187.           => #<window 1 on objects.texi>
  1188.  
  1189.    *Note Windows::, for a description of the functions that work on
  1190. windows.
  1191.  
  1192.  
  1193. 
  1194. File: elisp,  Node: Window Configuration Type,  Next: Marker Type,  Prev: Window Type,  Up: Editing Types
  1195.  
  1196. Window Configuration Type
  1197. -------------------------
  1198.  
  1199.    A "window configuration" stores information about the positions
  1200. and sizes of windows at the time the window configuration is created,
  1201. so that the screen layout may be recreated later.
  1202.  
  1203.    Window configurations have no read syntax.  They print as
  1204. `#<window-configuration>'.  *Note Window Configurations::, for a
  1205. description of several functions related to window configurations.
  1206.  
  1207.  
  1208. 
  1209. File: elisp,  Node: Marker Type,  Next: Process Type,  Prev: Window Configuration Type,  Up: Editing Types
  1210.  
  1211. Marker Type
  1212. -----------
  1213.  
  1214.    A "marker" denotes a position in a specific buffer.  Markers
  1215. therefore have two components: one for the buffer, and one for the
  1216. position.  The position value is changed automatically as necessary
  1217. as text is inserted into or deleted from the buffer.  This is to
  1218. ensure that the marker always points between the same two characters
  1219. in the buffer.
  1220.  
  1221.    Markers have no read syntax.  They print in hash notation, giving
  1222. the current character position and the name of the buffer.
  1223.  
  1224.      (point-marker)
  1225.           => #<marker at 10779 in objects.texi>
  1226.  
  1227.    *Note Markers::, for information on how to test, create, copy, and
  1228. move markers.
  1229.  
  1230.  
  1231. 
  1232. File: elisp,  Node: Process Type,  Next: Stream Type,  Prev: Marker Type,  Up: Editing Types
  1233.  
  1234. Process Type
  1235. ------------
  1236.  
  1237.    The word "process" means a running program.  Emacs itself runs in
  1238. a process of this sort.  However, in Emacs Lisp, a process is a Lisp
  1239. object that designates a subprocess created by Emacs process. 
  1240. External subprocesses, such as shells, GDB, ftp, and compilers, may
  1241. be used to extend the processing capability of Emacs.
  1242.  
  1243.    A process takes input from Emacs and returns output to Emacs for
  1244. further manipulation.  Both text and signals can be communicated
  1245. between Emacs and a subprocess.
  1246.  
  1247.    Processes have no read syntax.  They print in hash notation,
  1248. giving the name of the process:
  1249.  
  1250.      (process-list)
  1251.           => (#<process shell>)
  1252.  
  1253.    *Note Processes::, for information about functions that create,
  1254. delete, return information about, send input or signals to, and
  1255. receive output from processes.
  1256.  
  1257.  
  1258.